import java.net.MalformedURLException;
import java.net.ServerSocket;
import java.rmi.Naming;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;


public class CheckAlive extends Thread 
{
	ServerSocket dServerSocket;
	CentralServerInterface dCentralServer;
	String centralServerhostName = "";
	String rmiServer = "CentralServer";
	CheckAlive(ServerSocket pServer)
	{
		dServerSocket = pServer;
		centralServerhostName = Server.centralServerhostName;
	}
	public void run()
	{
				while(true)
				{
					try 
					{
						dCentralServer = (CentralServerInterface) Naming.lookup ("//" + centralServerhostName + "/"+rmiServer);
						dCentralServer.mUpdateTimeStamp(Server.mGetHostName() ,"" + dServerSocket.getLocalPort());
						Thread.sleep(5000);
					} 
					catch (Exception e) 
					{
						e.printStackTrace();
					}
					
				}
	}

}
